package cz.cvut.manatee.processManager;

public abstract class ContainsCorpusQuery extends Query {

	/*
	 * nazev korpusu na kterem bude dotaz pracovat
	 */
	protected final String corpusName; 

	/*
	 * pripocteni score pri shode s korpusem
	 */
	protected static int compareEqualCorpus = 50; 
	
	public ContainsCorpusQuery(String corpusName){
		super();
		this.corpusName = corpusName;
	}
	
	public String getCorpusName() {
		return corpusName;
	}
	
	@Override
	public int compare(Query dotaz) {
		//int predek = super.compare(dotaz);
		if (dotaz != null) {
			if(dotaz instanceof ContainsCorpusQuery) {
				ContainsCorpusQuery novy_dotaz = (ContainsCorpusQuery)dotaz;
				if (novy_dotaz.getCorpusName().equalsIgnoreCase(this.getCorpusName())) {
					return ContainsCorpusQuery.compareEqualCorpus;
				}
			}
		}
		return 0;
	}
	
	/*
	 * Vypisuje svuj obsah
	 */
	public String toString() {
		return super.toString()+"\""+this.corpusName+"\"";
	}
}
